# @Author: Eric Ito
# @Date: 1/25/2009
# Project Euler problem 4

"""
Find the largest palindrome made from the 
product of 2 3-digit numbers
"""

def reverse(numStr):
	revStr = ""
	for i in numStr:
		revStr = i + revStr
	return revStr
	
def isPalindrome(numStr):
	if numStr == reverse(numStr):
		return True
	else:
		return False
		
def main():
	max = 0
	for i in range(999,99,-1):
		for j in range(999,99,-1):
			prod = j*i
			if isPalindrome(str(prod)):
				if max < prod:
					max = prod
	print max
if __name__ == "__main__":
	main()